﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using SilverlightAndAspdotNetMVC.Web.Service;
using SilverlightAndAspdotNetMVC.Web.Models;

namespace SilverlightAndAspdotNetMVC.Web.ShareService
{
    /// <summary>
    /// WebService1 的摘要说明
    /// </summary>

    [WebService(Namespace = "http://sunzone.com/webservices/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消对下行的注释。
    // [System.Web.Script.Services.ScriptService]
    public class WebService1 : System.Web.Services.WebService
    {
        MonitorDataService mds = new MonitorDataService();
        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

        [WebMethod]
        public MonitorDataEntity GetMonitorDataWintZoneId(string zoneId)
        {
            MonitorDataEntity mde = null;
            try
            {
                mde = mds.GetMonitorDataWithZoneId(zoneId);
            }
            catch (Exception ex)
            {
                return new MonitorDataEntity()
                {
                    Success = false,
                    ErrorMessage = ex.Message
                };
            }
            mde.Success = true;
            return mde;
        }
    }
}
